package com.crm.controller;

import com.crm.common.result.ResultVO;
import com.crm.service.IndexService;
import com.crm.vo.VulnerabilityVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;

/**
 * \* User: chy
 * \* Date: 2025/9/6  8:50
 * \* Description:统计
 * \
 */
@RestController
@RequestMapping("/report")
@Slf4j
public class ReportController {

    @Autowired
    private IndexService indexService;

    /**
     * 获取首页统计信息
     * @param endCreateTime
     * @param endCreateTime
     * @return
     */
    @GetMapping("/getVulnerabilityMap/{beginCreateTime}/{endCreateTime}")
    public ResultVO<VulnerabilityVO> getVulnerabilityMap(@PathVariable LocalDate beginCreateTime, @PathVariable LocalDate endCreateTime)
    {
        log.info("查询首页统计信息{}。", beginCreateTime);
        VulnerabilityVO vulnerabilityVO = indexService.getVulnerabilityMap(beginCreateTime, endCreateTime);
        return ResultVO.success(vulnerabilityVO) ;
    }
}
